package de.htwds.mada.todolistDB.model;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "category")
public class Category {

	public static final String CAT_ID_FIELD = "_id"; //primary key
	public static final String NAME_FIELD = "name";
	
	@DatabaseField(columnName = CAT_ID_FIELD, generatedId = true)
	private int _id;
	
	@DatabaseField(columnName = NAME_FIELD, unique = true)
	private String name;
	
	public Category() {}
	
	/**
	 * Returns the id
	 * @return id
	 */
	public int getId() {
		return _id;
	}
	
	/**
	 * Returns the category name
	 * 
	 * @return	category name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Set a new id value
	 * 
	 * @param id	the new id
	 */
	public void setId(int id) {
		this._id = id;
	}
	
	/**
	 * Set a new name
	 * 
	 * @param name	name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * Gets the category name
	 * 
	 * @return	category name
	 */
	public String toString() {
		return name;
	}
	
	/**
	 * Returns the formated category name with id
	 * 
	 * @return	category name and id as formated string
	 */
	public String toStringComplete() {
		return "Category: "+ name + ", Id: " + _id;
	}

}
